﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Generico.Coneccion;

namespace RosarioFinanzas
{
    public partial class NoticiasSugeridas : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {



            var cn = new ClsConeccion();
            cn.Abrir();

            DateTime haceUnaSemana = DateTime.Now.AddDays(-7);

            string sql = "SELECT TOP 5 ROW_NUMBER() OVER (ORDER BY Leidas desc ) AS Row, Id, Titulo FROM Noticias Where Fecha >= convert(datetime, '" + haceUnaSemana.ToShortDateString()  + "', 105) order by Leidas desc";

            var sqldr2 = cn.EjecutarSqlDataReader(sql);
            var dt = new DataTable();
            dt.Load(sqldr2);

            cn.Cerrar();

            ListView1.DataSource = dt;

            ListView1.DataBind();
            cn.Cerrar();
        }
    }
}
